package com.example.demo.service.order;

import java.util.List;

import com.example.demo.domain.order.SaleOrderItem;
import com.example.demo.mapper.order.SaleOrderItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.domain.order.SaleOrder;
import com.example.demo.domain.userInfo.UserInfo;
import com.example.demo.mapper.order.SaleOrderMapper;
import com.example.demo.mapper.userInfo.UserInfoMapper;
@Service
public class SaleOrederServiceImpl implements SaleOrderService{


	@Autowired
	private SaleOrderMapper saleOrderMapper;
	
	@Autowired
	private UserInfoMapper userInfoMapper;

	@Autowired
	private  SaleOrderItemMapper saleOrderItemMapper;

	@Override
	public SaleOrder getSaleOrderItem(Integer orderId) {
		SaleOrder saleOrder = saleOrderMapper.selectByPrimaryKey(orderId);
		SaleOrderItem saleOrderItem = new SaleOrderItem();
		saleOrderItem.setSaleorderno(saleOrder.getSaleorderno());
		List<SaleOrderItem> saleOrderItemList = saleOrderItemMapper.selectSaleOrderItemList(saleOrderItem);
		saleOrder.setSaleOrderItem(saleOrderItemList);
		return saleOrder;
	}

	@Override
	public int deleteByPrimaryKey(Integer orderId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insert(SaleOrder saleOrder) {
		// TODO Auto-generated method stub
		return this.saleOrderMapper.insert(saleOrder);
	}

	@Override
	public int insertSelective(SaleOrder saleOrder) {
		// TODO Auto-generated method stub
		return this.saleOrderMapper.insertSelective(saleOrder);
	}

	@Override
	public SaleOrder selectByPrimaryKey(Integer saleOrder) {
		// TODO Auto-generated method stub
		return this.saleOrderMapper.selectByPrimaryKey(saleOrder);
	}

	@Override
	public int updateByPrimaryKeySelective(SaleOrder saleOrder) {
		// TODO Auto-generated method stub
		return this.saleOrderMapper.updateByPrimaryKeySelective(saleOrder);
	}

	@Override
	public int updateByPrimaryKey(SaleOrder saleOrder) {
		// TODO Auto-generated method stub
		return this.updateByPrimaryKey(saleOrder);
	}

	@Override
	public List<SaleOrder> selectSaleOrderList(SaleOrder saleOrder) {
		// TODO Auto-generated method stub
		return this.saleOrderMapper.selectSaleOrderList(saleOrder);
	}
   
	@Override
	public List<UserInfo> selectBarberName() {
		// TODO Auto-generated method stub
		return this.userInfoMapper.selectBarberName();
	}

	@Override
	public List<UserInfo> selectCashierName() {
		// TODO Auto-generated method stub
		return this.userInfoMapper.selectCashierName();
	}

	@Override
	public List<SaleOrder> sumTotalByBarber(SaleOrder saleOrder) {
		return this.saleOrderMapper.sumTotalByBarber(saleOrder);
	}

	@Override
	public List<SaleOrder> sumTotalByMonth(String year) {
		return this.saleOrderMapper.sumTotalByMonth(year);
	}

	@Override
	public List<SaleOrder> compareTotalByYears() {
		return this.saleOrderMapper.compareTotalByYears();
	}

	@Override
	public List<SaleOrder> compareByQuarter(String year) {
		return this.saleOrderMapper.compareByQuarter(year);
	}

    @Override
    public List<SaleOrder> inSevenDays() {
        return this.saleOrderMapper.inSevenDays();
    }

	@Override
	public List<SaleOrder> sumByService(SaleOrder saleOrder) {
		return this.saleOrderMapper.sumByService(saleOrder);
	}

	@Override
	public List<SaleOrder> sumByTos(SaleOrder saleOrder) {
		return this.saleOrderMapper.sumByTos(saleOrder);
	}
}
